/*! \file identifiernode.h
	\author HiddenSeeker

	Defines an identifier node
*/
#pragma once
#include "../abstractnode.h"
#include<string>

/*! \class IdentifierNode
	A class of node with identifier
*/
class IdentifierNode: public AbstractNode
{
 private:
	     std::string * m_string_data;
		 unsigned int  m_index;  //!< Index of variable in the table
 public:
	    /*! Constructs a node from string
			 \param[in] pos position
			 \param[in] line line data
			 \param[in] data common data
		 */
	     inline IdentifierNode(const YYLTYPE & pos, std::string * data): AbstractNode(pos)
	     {
		   m_string_data=data;
		 }
		 /*! Checks, whether it's identifier
		  */
		 virtual bool isIdentifier();
		 /*!  Checks is node can be assigned
		 */
	   	virtual bool isLValue(ParentData * data);
		/*! Transforms a code, if needed to
			\return true on success
		 */
		 virtual bool checkLogic(ParentData * data);
		 /*! Fills a constant table
		  */
		 virtual void fillConstant(ParentData * data);
		 /*! Produces a code for method
		  */
		 virtual void produceCode(ParentData * data);
		 /*! Returns a data
		 */
	     inline const std::string & data() { return *m_string_data; }
		 /*! Returns  type
		  */
		 virtual std::string getType(ParentData * data);
	     /*! Writes a node data to stream
		 */
		 void write(GraphStream * s);
		 /*! Destructor
		 */
		 ~IdentifierNode();
};
